import 'package:thinking/config/_.dart';
import 'package:thinking/entity/_.dart';
import 'package:thinking/http/Dio.dart';
import 'package:dio/dio.dart';
class SearchService{
  static Future<List<SearchRecommendEntity>?> getSearchRecommend({Map<String,dynamic>? params}) async{
    var res = await HttpApi().get(url: Config.apiUrl['ApiList']['getSearchRecommend'],params: params,options:Options(extra:{'showLoading':false}));
    return SearchRecommend.fromJson(res).data!.searchRecommendList;
  }

  static Future<List<Think>?> getSearchThinkData({Map<String,dynamic>? params}) async{
    var res = await HttpApi().get(url: Config.apiUrl['ApiList']['getSearchThinkData'],params: params,options:Options(extra:{'showLoading':false}));
    return HomeResult.fromJson(res['data']).thinkData;
  }

  static Future<List<DynamicDataEntity>?> getSearchDynamicData({Map<String,dynamic>? params}) async{
    var res = await HttpApi().get(url: Config.apiUrl['ApiList']['getSearchDynamicData'],params: params,options:Options(extra:{'showLoading':false}));
    return DynamicResult.fromJson(res['data']).dynamicList;
  }

  static Future<List<UserData>?> getSearchUserData({Map<String,dynamic>? params}) async{
    var res = await HttpApi().get(url: Config.apiUrl['ApiList']['getSearchUserData'],params: params,options:Options(extra:{'showLoading':false}));
    return UserListResult.fromJson(res['data']).userList;
  }

  static Future<List<UserData>?> getRecentVisitUserData({Map<String,dynamic>? params}) async{
    var res = await HttpApi().get(url: Config.apiUrl['ApiList']['getRecentVisitUserData'],params: params,options:Options(extra:{'showLoading':false}));
    return UserListResult.fromJson(res['data']).userList;
  }

  static Future<List<Tag>?> getSearchTopicData({Map<String,dynamic>? params}) async{
    var res = await HttpApi().get(url: Config.apiUrl['ApiList']['getSearchTopicData'],params: params,options:Options(extra:{'showLoading':false}));
    return TagClassEntity.fromJson(res).data!.tagList;
  }

}